<?php

class core_panelbase extends core_modbase
{	
	function __construct($panel)
	{
		$this->template = new template();
		$this->translator = new translator(get_class($this));
		$this->translator->load('common');
		
		try {
			$this->translator->load($panel);
		} catch (NoTranslation $e)
		{ }
		
		new session();
		
		$menu = $this->translator->get('panel_title');
		if ($menu)
		{
			$menu = array ($menu => '{UP}' . core_modules::modDir(get_class($this)));
			core_signal::SmpSignal('user::menu', $menu);
		}
	}
	
	function submenu()
	{
		$methods = get_class_methods(get_class($this));
		$menu = array();
		foreach ($methods as $method)
		{
			$method = strtolower($method);
			$translate = $this->translator->get($method);
			if ($translate)
			{
				$menu[$translate] = '{UP}' . core_modules::modDir(get_class($this)) . '/' . substr($method, 5);
			}
		}
		return $menu;
	}
}
